//DO NOT REMOVE LINES 1-8, KEEP ORIGINAL TERMS (Name=,Version=,etc)
//Name=Super Scroller V2
//Version=2.0.0
//Author=JarC
//Description=
//Description0x0804=
//In-URL=*
//Ex-URL=
//--------------------------------------------------------------------------------
// ==UserScript==
// @name		Super Scroller V2
// @namespace	http://superscroller.googlecode.com/svn/trunk/
// @include		*
// @exclude
// ==/UserScript==

/*
parts based on:
onMouseover Scrollbar effect by Svetlin Staev (svetlins@yahoo.com) (excl. effect)
http://www.dynamicdrive.com/dynamicindex11/scrolleffect.htm

Smooth Scroller by Dezinerfolio Inc. (midart@gmail.com)
http://www.dezinerfolio.com/2007/08/08/df-javascript-smooth-scroll
*/

/*
var is =
{
    ua :			navigator.userAgent,
    Opera :			Object.prototype.toString.call(window.opera) == '[object Opera]',
    IE :			(window.attachEvent && !is.Opera),
    WebKit :		is.ua.indexOf('AppleWebKit/') != -1,
    Gecko :			(is.ua.indexOf('Gecko') != -1 && is.ua.indexOf('KHTML') == -1),
    MobileSafari :	/Apple.*Mobile.*Safari/.test(is.ua);
}
*/
var is =
{
	IE: (document.all && !window.opera),
	WebKit: RegExp(" AppleWebKit/").test(navigator.userAgent),
	MobileSafari: RegExp("Apple.*Mobile.*Safari").test(navigator.userAgent)
}

// Powerband debug console options (can be used both in IE and Maxthon)
var jsdbgOn = true;

if(typeof(document.parentWindow)!='undefined')
{
	var __ex_pb_debugobject = document.parentWindow.PowerBand;
	jsdbgOn = true;
}

function __isActivedebugPage( )
{
	if( typeof(jsdbgOn) == 'undefined' )
	{
		if(document.location.search.search(/[?|&]jsdbgOn=true/i)!=-1) return ( true )
		return ( false );
	}

	return ( jsdbgOn ? true : false );
}

// Don't change function name !!!
function __inline__pb__foreach(obj)
{
	for (var prop in obj )
	{
		var pName = '.' + prop;
		__ex_pb_debugobject.SendObject(pName, obj[prop]);
	}
}

// Webkit debug console options
var options = { debug:'true',cursor:'true',button:0,scaling:2,speed:6000,friction:5 }

function dobug()
{
	if(options.debug) console.debug.apply(console,['sS:'].concat(Array.prototype.slice.call(arguments)));
}

var debug_INTERVAL = 100;
var lastdebug = 0;

function debugCont()
{
	if(options.debug)
	{
		var now = Date.now();
		if(lastdebug+debug_INTERVAL <= now)
		{
			lastdebug = now;
			console.debug.apply(this,arguments);
		}
	}
}
// End Webkit debug options

// create global debug device
var jsdbg =
{
	EnterMethod				: function(str)			{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.EnterMethod(str);} },
	ExitMethod				: function(str)			{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.ExitMethod(str);} },
	Locate					: function(obj)			{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.Locate(obj);} },
	RegisterScriptHelper	: function()			{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.RegisterScriptHelper(str);} },
	SendMessage				: function(str)			{ if (is.IE) { if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.SendMessage(str);} }
													  if (is.WebKit) dobug(str);
													},
	SendObject				: function(str, obj)	{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.SendObject(str, obj);} },
	SendObjectEx			: function(str, obj)	{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.SendObjectEx(str, obj);} },
	ShowdebugView			: function(bool)		{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.ShowdebugView(bool);} },
	CleardebugView			: function()			{ if( __isActivedebugPage() && __ex_pb_debugobject ) { __ex_pb_debugobject.CleardebugView();} }
}

// === Vector math ===
var VectorMath =
{
	add:  function(a,b) { return [a[0]+b[0], a[1]+b[1]] },
	sub:  function(a,b) { return [a[0]-b[0], a[1]-b[1]] },
	mul:  function(s,v) { return [s*v[0], s*v[1]] },
	div:  function(s,v) { return [v[0]/s, v[1]/s] },
	mag:  function(v)	{ return Math.sqrt(v[0]*v[0] + v[1]*v[1]) },
	mag2: function(v)	{ return v[0]*v[0] + v[1]*v[1] },
	unit: function(v)	{ return this.div(this.mag(v),v) }
}

var sS =
{
	X:null,
	Y:null,
	newY:null,
	snooze:500,
	delta:[null,null],
	step:1,
	delay:0,
	speed:10,
	scaling:2,
	offsetTop:0,
	jumpTarget:0,
	modifier:0,
	button:null,
	thumbFace:null,
	scrollerImg:null,
	docBody:null,
	winWide:0,
	winHigh:0,
	deadVZone:0,
	overlap:30,
	multiMon:1,
	hoverWidth:0,
	Hovering:false,
	Dragging:false,
	JumpMove:false,
	NoGoTags:',HTML,A,AREA,IMG,OBJECT,EMBED,',
	FormTags:',INPUT,SELECT,TEXTAREA,BUTTON,LABEL,',
//	----------------------------------------------------------------------------
	init : function()
	{
	if (is.MobileSafari) return;
		jsdbg.CleardebugView();
		jsdbg.SendMessage('loaded');

		if(is.WebKit) sS.button = 0;
		else sS.button = 1;

// friggin Maxthon2 almost leaves no room to manouvre...

		if(sS.multiMon) sS.hoverWidth = 12;
		else sS.hoverWidth = 20;

		sS.docBody = document.body;
//IE 6+ in 'standards compliant mode'
		if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
			sS.docBody = document.documentElement;
		else
		if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
			sS.docBody = document.body;

		var s = sS.getScrollPosition();
		sS.onResize();

		sS.addEvent(document,'beforeunload',sS.beforeUnload);

		sS.addEvent(document,'mousedown',sS.onMDown);
		sS.addEvent(document,'mousemove',sS.onMMove);
		sS.addEvent(document,'mouseout',sS.onMOut);
		sS.addEvent(document,'mouseup',sS.onMUp);
		sS.addEvent(document,'keydown',sS.onKDown);

		sS.addEvent(window,'mouseout',sS.onMOut);
		sS.addEvent(window,'resize',sS.onResize);

		if((s.h > sS.winHigh) && (sS.winHigh > 200))
		{
			sS.injectMap();
			sS.injectImage();
//			if(is.IE) sS.thumbFace = sS.docBody.style.scrollbarFaceColor;
			if((document.compatMode!='CSS1Compat')) sS.addEvent(window,'scroll',sS.onScroll);
		}

/*
		if(frames.length>0)
		{
			for(i=0;i<frames.length;i++)
			{	// if there are frames (or iframes)
				try { }
				catch(asdf){}
			}
		}
*/
	},
// =============================================================================
	injectImage : function()
	{
		var scrollButton;
		scrollButton =  document.createElement('img');
		scrollButton.id = 'superScrollerImg';
		scrollButton.src= '';

		if(document.compatMode!='CSS1Compat')
			scrollButton.style.position = 'absolute';
		else
			scrollButton.style.position = 'fixed';
		scrollButton.style.top = '50%';
		scrollButton.style.right = '0';
		scrollButton.style.width = '20px';
		scrollButton.style.height = '100px';
		scrollButton.style.border = 'none';
		scrollButton.style.padding = 0;
		scrollButton.style.margin = 0;
		scrollButton.style.marginTop = '-50px'
		scrollButton.style.zIndex = '9999';
		scrollButton.useMap = '#scroller21593';
		document.body.appendChild(scrollButton);
		sS.scrollerImg = document.getElementById('superScrollerImg');
	},
// -----------------------------------------------------------------------------
	injectMap : function()
	{
		var imageMap, mapArea;
		var mapArray = [];
		mapArray = [['0, 0,19,24','jumpTop','Top'],['0,25,19,49','jumpUp','PgUp'],['0,50,19,74','jumpDn','PgDn'],['0,75,19,99','jumpEnd','Bottom']];
		imageMap = document.createElement('map');
		imageMap.setAttribute('name', 'scroller21593', 0);
		imageMap.id = 'scroller21593';
		for (i=0;i<mapArray.length;i++)
		{
			mapArea = document.createElement('area');
			mapArea.shape = 'rect';
			mapArea.coords = mapArray[i][0];
			mapArea.href = 'javascript:sS.'+mapArray[i][1]+'()';
			mapArea.title = mapArray[i][2];
			imageMap.appendChild(mapArea);
		}
		document.body.appendChild(imageMap);
	},
// =============================================================================
	addEvent : function(el, evt, fn)
	{
		if(el.attachEvent){ el.attachEvent('on'+evt, fn); }
		else
		if(el.addEventListener){ el.addEventListener(evt,fn,true); }
		else {el['on'+evt] = fn;}
	},
// -----------------------------------------------------------------------------
	delEvent : function(el, evt, fn)
	{
		if(el.detachEvent){ el.detachEvent('on'+evt,fn); }
		else
		if(el.removeEventListener){ el.removeEventListener(evt,fn,true); }
		else { el['on'+evt] = null; }
	},
// -----------------------------------------------------------------------------
	hltEvent : function(evt)
	{
		if(!evt) var evt = window.event;
		if(evt.stopPropagation)
		{ evt.stopPropagation(); evt.preventDefault(); }
		else
		if(typeof evt.cancelBubble != 'undefined')
		{ evt.cancelBubble = true; evt.returnValue = false; }
		return false;
	},
// -----------------------------------------------------------------------------
	evtSource : function(evt)
	{
		if(window.event){ return window.event.srcElement; }
		else { return evt.currentTarget; }
	},
// -----------------------------------------------------------------------------
	evtTarget : function(evt)
	{
		if(window.event){ return window.event.srcElement; }
		else { return evt.target; }
	},
// -----------------------------------------------------------------------------
	hltSelect : function(el) // for IE only
	{
		if(typeof(el.onselectstart) != 'undefined')
		{ sS.addEvent(el,'selectstart',function(){ return false; }); }
	},
// =============================================================================
	posInfo: function(evt)
	{
		if(!evt) evt = window.event;
		var m = sS.getMousePosition(evt);
		var s = sS.getScrollPosition();

		jsdbg.SendMessage('Scroll.X: '+s.x+' | Scroll.Y: '+s.y);
		jsdbg.SendMessage('Mouse.X: '+m.x+' | Mouse.Y: '+m.y);
		jsdbg.SendMessage('Delta.X: '+sS.delta[0]+' | Delta.Y: '+sS.delta[1]);
		jsdbg.SendMessage('Delayer: '+sS.delay);
		jsdbg.SendMessage('sS.Hovering:'+sS.Hovering);
		jsdbg.SendMessage('sS.JumpMove:'+sS.JumpMove);
		jsdbg.SendMessage('sS.jumpTarget:'+sS.jumpTarget);
		jsdbg.SendMessage('sS.offsetTop:'+sS.offsetTop);
	},
// -----------------------------------------------------------------------------
	getMousePosition : function(evt)
	{
		var x = 0, y = 0;
		if(!evt) evt = window.event;
//		if(evt.pageX || evt.pageY) { posX = evt.pageX; posY = evt.pageY; }
//		else
		if(evt.clientX || evt.clientY) { x = evt.clientX; y = evt.clientY; }
		var position = { 'x' : x, 'y' : y };
//		jsdbg.SendMessage('m.x:'+x+' | m.y:'+y);
		return position;
	},
// -----------------------------------------------------------------------------
	getScrollPosition : function()
	{
		var x = 0, y = 0, w = 0, h = 0;
		if(typeof(window.pageYOffset) == 'number')
		{
			x = window.pageXOffset; y = window.pageYOffset;
			w = document.body.scrollWidth; h = document.body.scrollHeight;
		}
		else
		{
			x = sS.docBody.scrollLeft; y = sS.docBody.scrollTop;
			w = sS.docBody.scrollWidth; h = sS.docBody.scrollHeight;
		}
		var position = { 'x' : x, 'y' : y, 'w' : w, 'h' : h };
//		jsdbg.SendMessage('Scroll.X: '+x+' | Scroll.Y: '+y);
		return position;
	},
// -----------------------------------------------------------------------------
	setScrollPosition : function() {},
// -----------------------------------------------------------------------------
// viewport dimensions minus scrollbars
	getWinSize : function()
	{
		var w = 0, h = 0;
		if(typeof(window.innerWidth) == 'number')
		{ w = window.innerWidth-20; h = window.innerHeight; }
		else
		{ w = sS.docBody.clientWidth; h = sS.docBody.clientHeight; }
		var winsize = { 'w' : w, 'h' : h };
		jsdbg.SendMessage('Win.W: '+w+' | Win.H: '+h);
		return winsize;
	},
// =============================================================================
// can the element be scrolled? (i.e. are scrollbars showing)
	canScroll : function(el)
	{
		var overFlow;
		if (el.scrollWidth > el.clientWidth)
		{
			overFlow = document.defaultView.getComputedStyle(el)["overflow-x"];
			if (overFlow == "auto" || overFlow == "scroll") return true;
		}
		if (el.scrollHeight > el.clientHeight)
		{
			overFlow = document.defaultView.getComputedStyle(el)["overflow-y"];
			if (overFlow == "auto" || overFlow == "scroll") return true;
		}
		return false;
	},
// -----------------------------------------------------------------------------
// Return the first scrollalbe parent (or the element itself)
	findScrollBox : function(el)
	{
		if (el == null || el == document.body || sS.canScroll(el)) return el;
		else return arguments.callee(el.parentNode);
	},
// =============================================================================
	onResize : function(evt)
	{
		var w = sS.getWinSize();
		sS.winWide = w.w;
		sS.winHigh = w.h;
		sS.deadVZone = w.h/2;
	},
// -----------------------------------------------------------------------------
	onKDown : function(evt)
	{
		sS.modifier = 0;
		if(evt)
			sS.modifier = (evt['altKey']||evt['shiftKey']||evt['ctrlKey']||evt['metaKey']);
		else
			sS.modifier = (event.ctrlKey&&17||event.altKey&&18||event.shiftKey&&16);

		if (!sS.modifier) sS.modifier = (event.keyCode==91);

//		if(sS.NoGoTags.indexOf(','+sS.evtTarget(evt).tagName+',')==-1)
			jsdbg.SendMessage(event.keyCode+'|'+sS.modifier);

		if(sS.FormTags.indexOf(','+sS.evtTarget(evt).tagName+',')==-1)
		if(evt['ctrlKey']||event.ctrlKey)
		{
//			if(event.keyCode==33) { sS.jumpTop(); sS.hltEvent(evt); }
//			if(event.keyCode==34) { sS.jumpEnd(); sS.hltEvent(evt); }
		}
		else
		{
			if(event.keyCode==36) { sS.jumpTop(); sS.hltEvent(evt); }
			if(event.keyCode==33) { sS.jumpUp(); sS.hltEvent(evt); }
			if(event.keyCode==34) { sS.jumpDn(); sS.hltEvent(evt); }
			if(event.keyCode==35) { sS.jumpEnd(); sS.hltEvent(evt); }
		}
	},
// -----------------------------------------------------------------------------
	onKUp : function (evt)
	{
	},
// =============================================================================
	onMDown : function(evt)
	{
		if(!evt) evt = window.event;

		var m = sS.getMousePosition(evt);
		var s = sS.getScrollPosition();

		sS.offScreen();

//		jsdbg.CleardebugView();
//		jsdbg.SendMessage(m.x+"|"+sS.winWide+"|"+m.y+"|"+sS.deadVZone);

		if(!sS.Hovering && (m.x < sS.winWide) && (s.h > sS.winHigh))
		{
			if(evt.button!=sS.button){
				jsdbg.SendMessage('ignoring, wrong button: '+evt.button);}
			else
			if((sS.NoGoTags+sS.FormTags).indexOf(','+sS.evtTarget(evt).tagName+',')!=-1)
				jsdbg.SendMessage('ignoring, wrong element: '+sS.evtTarget(evt).tagName);
			else
			if(sS.modifier)
			{
				jsdbg.SendMessage('ignoring, modifier key: '+sS.modifier);
				sS.modifier = 0;
			}
			else
			{
//				sS.hltSelect(document);
				document.onselectstart = function () {return false};
				if(!sS.Dragging) jsdbg.SendMessage('starting dragscroll...');
				jsdbg.SendMessage('button: '+event.button);
				jsdbg.SendMessage('element: '+event.srcElement.tagName);
				sS.Dragging = true;
				document.body.style.cursor = 'move';
// point where drag was initiated
				sS.X = m.x;
				sS.Y = m.y;
			}
		}
	},
// -----------------------------------------------------------------------------
	onMMove : function(evt)
	{
		if(!evt) evt = window.event;

		var m = sS.getMousePosition(evt);
		var s = sS.getScrollPosition();

//		jsdbg.SendMessage(m.x+"|"+sS.winWide+"|"+m.y+"|"+sS.deadVZone);

		if(	(m.x > (sS.winWide-20)) && (m.x < sS.winWide) && (m.y > (sS.deadVZone-50)) && (m.y < (sS.deadVZone+50)) ) sS.Scroller('show');
		else sS.Scroller('hide');

		if(sS.Dragging&&(evt.button==sS.button))
		{
			sS.onDrag(evt);
		}
		else
// need fullproof way in IE to detect if mouse has left the window.
		if((m.x > sS.winWide) && (m.x < (sS.winWide+sS.hoverWidth)) && (s.h > sS.winHigh))
		{
			sS.Hovering = false;
			sS.JumpMove = false;
			sS.onHover(evt);
		}
		else
//		if (sS.Hovering)
		{
			sS.onMOut();
		}
	},
// -----------------------------------------------------------------------------
	onMOut : function()
	{
		if(sS.Hovering||sS.JumpMove)
		{
			sS.offScreen();
			jsdbg.SendMessage('leaving...');
		}
	},
// -----------------------------------------------------------------------------
	onMUp : function(evt)
	{
		if(!evt) evt = window.event;
		if((evt.button==sS.button) && sS.Dragging)
		{
			jsdbg.SendMessage('stopping dragscroll...');
			document.body.style.cursor = 'auto';
			document.onselectstart = null;
			sS.Dragging = false;
//			sS.X = null;
//			sS.Y = null;
//?			sS.jumpTarget = null;
		}
	},
// =============================================================================
	onDrag : function(evt)
	{
		var m = sS.getMousePosition(evt);
		var s = sS.getScrollPosition();

		if(sS.Dragging)
		{
			jsdbg.CleardebugView();
			jsdbg.EnterMethod('onDrag');

			sS.posInfo(evt);

			sS.delta = [(sS.X-m.x),(sS.Y-m.y)];
			sS.X = m.x;
			sS.Y = m.y;
			scrollBy(sS.delta[0]*sS.scaling,sS.delta[1]*sS.scaling);
			jsdbg.ExitMethod('onDrag');
		}
	},
// -----------------------------------------------------------------------------
	onHover : function(evt)
	{
		if(sS.Hovering||sS.JumpMove) return;
		jsdbg.CleardebugView();
		jsdbg.EnterMethod('onHover');

		var m = sS.getMousePosition(evt);
		var s = sS.getScrollPosition();

		jsdbg.SendMessage(m.x+"|"+sS.winWide+"|"+m.y+"|"+sS.deadVZone);
		if (m.x >= (sS.winWide+sS.hoverWidth)) sS.MOut;

		inTheVZone = (m.y >= (sS.deadVZone-8) && m.y <= (sS.deadVZone+8));
		if(inTheVZone) sS.offScreen();
		else
		{
			distance = Math.floor(sS.deadVZone - Math.abs(sS.deadVZone-m.y));
// hovering on thumb jumps to top/bottom
			if(distance < 20)
			{
				sS.jumpTarget = (m.y < sS.deadVZone)?0:s.h-sS.deadVZone;
				sS.delay = 1;
			}
			else
// timerinterval = distance from deadzone calculated as percentage
				sS.delay = Math.floor((distance/sS.deadVZone)*100);

			if(!(sS.Hovering||sS.JumpMove)
			&& (((m.y < sS.deadVZone) && (s.y > 0))
			|| ((m.y > sS.deadVZone) && (s.y < (s.h-sS.winHigh)))))
			{
//				sS.posInfo();
//				sS.docBody.style.scrollbarFaceColor = 'highlight';
				clearInterval(sS.scrollTmr);
				if(!sS.JumpMove && (sS.delay == 1))
				{
					jsdbg.SendMessage('starting jumpscroll...');
					sS.scrollTmr = setInterval('sS.jumpTo(sS.jumpTarget)', sS.speed);
				}
				else
				if(!sS.Hovering && (sS.delay != 1) && (m.x < (sS.winWide+14)))
				{
					jsdbg.SendMessage('starting hoverscroll...');
					if(m.y > sS.deadVZone)
						sS.scrollTmr = setInterval('sS.scrollPage(1)', sS.delay);
					else
						sS.scrollTmr = setInterval('sS.scrollPage(-1)', sS.delay);
				}
				else sS.MOut();
			}
			else
				jsdbg.SendMessage('motionless');
		}
		jsdbg.ExitMethod('onHover');
	},
// -----------------------------------------------------------------------------
	onScroll : function(evt) // only for Quirks Mode
	{
//		var scrlTop = document.body.scrollTop;
		sS.scrollerImg.style.top = document.body.scrollTop+sS.deadVZone;
	},
// -----------------------------------------------------------------------------
// executes while the mouse is hovering over the scrollbar thumb arrows
	jumpTo: function(jumpTarget)
	{
//		jsdbg.CleardebugView();
		jsdbg.EnterMethod('jumpTo')

		var s = sS.getScrollPosition();

		if(jumpTarget >= s.y)
			if((s.h-jumpTarget)>sS.winHigh)
				s.y+=Math.ceil((jumpTarget-s.y)/sS.speed);
			else
				s.y+=Math.ceil((jumpTarget-s.y-(s.h-jumpTarget))/sS.speed);
		else
			s.y += Math.floor((jumpTarget-s.y)/sS.speed);

		jsdbg.SendMessage('offsetTop:'+sS.offsetTop);
		if(s.y != sS.offsetTop)
		{
			jsdbg.SendMessage('jumping to: '+s.y);
			sS.JumpMove = true;
			scrollTo(s.x,s.y);
		}
		else
		{
			jsdbg.SendMessage('stopping jumpscroll...');
			sS.offScreen();
		}
		sS.offsetTop = s.y;
		jsdbg.ExitMethod('jumpTo')
	},
// -----------------------------------------------------------------------------
	jumpTop : function()
	{
		sS.jumpTarget = 0;
		clearInterval(sS.scrollTmr);
		sS.scrollTmr = setInterval('sS.jumpTo(sS.jumpTarget)',sS.speed);
	},
// -----------------------------------------------------------------------------
	jumpUp : function()
	{
		var s = sS.getScrollPosition();

		var nextTarget = s.y-(sS.winHigh-sS.overlap);
		sS.jumpTarget = (nextTarget <= 0?0:nextTarget);
		clearInterval(sS.scrollTmr);
		sS.scrollTmr = setInterval('sS.jumpTo(sS.jumpTarget)',sS.speed);
	},
// -----------------------------------------------------------------------------
	jumpDn : function()
	{
		var s = sS.getScrollPosition();

		var nextTarget = s.y+(sS.winHigh-sS.overlap);
		var skipHeight = s.h-sS.deadVZone;
		sS.jumpTarget = (nextTarget >= s.h-sS.winHigh?skipHeight:nextTarget);
		clearInterval(sS.scrollTmr);
		sS.scrollTmr = setInterval('sS.jumpTo(sS.jumpTarget)',sS.speed);
	},
// -----------------------------------------------------------------------------
	jumpEnd : function()
	{
		var s = sS.getScrollPosition();

		sS.jumpTarget = s.h-sS.deadVZone;
		clearInterval(sS.scrollTmr);
		sS.scrollTmr = setInterval('sS.jumpTo(sS.jumpTarget)',sS.speed);
	},
// -----------------------------------------------------------------------------
	scrollPage : function(whichWay)
	{
//		jsdbg.CleardebugView();
//		jsdbg.EnterMethod('scrollPage')

		var s = sS.getScrollPosition();

		sS.offsetTop = (whichWay==1?(s.h-sS.winHigh):0);
		sS.step = 32*(100-sS.delay)/100;
		sS.newY = s.y+Math.floor(whichWay*sS.step);
		sS.delta = [s.x,(sS.newY-s.y)];

		if(s.y != sS.offsetTop)
		{
/*
			jsdbg.SendMessage('offset: '+sS.offsetTop);
			jsdbg.SendMessage('Delayer: '+sS.delay);
			jsdbg.SendMessage('oldPos.X: '+s.x+' oldPos.Y:'+s.y+'('+(s.h-sS.winHigh)+')');
			jsdbg.SendMessage('newPos.X: '+s.x+' newPos.Y:'+sS.newY+'('+(s.h-sS.winHigh)+')');
			jsdbg.SendMessage('Delta.X: '+sS.delta[0]+' | Delta.Y: '+sS.delta[1]);
*/
			sS.Hovering = true;
			scrollTo(s.x,sS.newY);
		}
		else
		{
//			jsdbg.SendMessage('stopping hoverscroll...');
			sS.offScreen();
		}

//		jsdbg.ExitMethod('scrollPage');
	},
// -----------------------------------------------------------------------------
	Scroller: function(state)
	{
		if(state=='show')
		{
			document.getElementById('superScrollerImg').style.display = 'block';
		}
		else
		{
			document.getElementById('superScrollerImg').style.display = 'none';
		}
	},
// -----------------------------------------------------------------------------
	offScreen : function()
	{
//		jsdbg.EnterMethod('offScreen');
		clearInterval(sS.scrollTmr);
		sS.scrollTmr = null;
//		sS.docBody.style.scrollbarFaceColor = sS.thumbFace;
//		sS.offsetTop = 0;

		sS.Dragging = false;
		sS.Hovering = false;
		sS.JumpMove = false;

//		jsdbg.ExitMethod('offScreen');
	},
// -----------------------------------------------------------------------------
	beforeUnload : function()
	{
		sS.delEvent(window,'resize',sS.onResize);

		sS.delEvent(document,'mousedown',sS.onMDown);
		sS.delEvent(document,'mousemove',sS.onMMove);
		sS.delEvent(document,'mouseup',sS.onMUp);
		sS.delEvent(document,'keydown',sS.onKDown);
	}
}
sS.init();
